import java.util.Arrays;
import java.util.concurrent.CountDownLatch;

public class CountDownLatchExample {
    private static final int THREAD_COUNT = 5;
    private static final CountDownLatch latch = new CountDownLatch(THREAD_COUNT);

    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < THREAD_COUNT; i++) {
            new Thread(() -> {
                System.out.println(Thread.currentThread().getName() + " is running");
                latch.countDown();
            }).start();
        }
        latch.await(); // 等待所有线程执行完毕
        System.out.println("All threads have finished");


        int[] numbers = {3, 1, 4, 1, 5};
        Arrays.sort(numbers);

        Arrays.asList(1, 2, 3);

    }
}
